#ifndef ALMLISTMODEL_H
#define ALMLISTMODEL_H
#include "Msg/ArrayListMsg.h"

#include <QAbstractTableModel>
#include <QMap>
#include <QList>
//#include "../../Global/FormatData.h"

class AlmListModel : public QAbstractTableModel
{
	Q_OBJECT
public:
    AlmListModel(QObject *parent = 0);
	~AlmListModel();

    int rowCount(const QModelIndex &parent) const;
    int columnCount(const QModelIndex &parent) const;

    QVariant data(const QModelIndex &index, int role= Qt::DisplayRole) const;
//    QVariant headerData(int section, Qt::Orientation orientation,
//                        int role= Qt::DisplayRole) const;
    //Q_INVOKABLE virtual QVariant headerData(int section, Qt::Orientation orientation,
    //                            int role = Qt::DisplayRole) const;
    virtual QHash<int,QByteArray> roleNames() const;

    //表头信息
//    Q_INVOKABLE QList<QString> getRoleNames();
    Q_INVOKABLE QList<int> getColumnWidths();
    Q_INVOKABLE QVariant getCellText(int nRow, int nCol);
    Q_INVOKABLE QVariant copyCellText(int nRow, int nCol);

    void InitRoleNames(const QString& sListName);
    void InitAlmData(const ArrayListMsg& htm);
    Q_INVOKABLE void setShowCheck(bool bShow,bool bDefaultCheck);
    Q_INVOKABLE void setCheck(int nRow, bool bCheck);
    Q_INVOKABLE void resetModel();
    Q_INVOKABLE bool getCheck(int nRow);
public slots:

private:
    //QString currencyAt(int offset) const;

    //QMap<QString, OrderInfo> currencyMap;
    QHash<int,QByteArray> m_roleNames;
    QStringList             m_dataIndex;
    int     m_nColumnCount;  //更新表头前，当前表头的列数.
	ArrayListMsg	 m_almData;
    bool            m_bShowCheck;
    QList<bool>     m_checkList;
//	CFormatData		 m_format;
};

#endif // ORDERISENTMODEL_H
